using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BlogEngine.Core.Providers;
using BlogEngine.Core;

public partial class gallery_deletephoto : System.Web.UI.Page
{
	protected Photo photo;

	protected void Page_Load(object sender, EventArgs e)
	{
		Guid guid = new Guid(Request.QueryString["PhotoId"]);
		photo = Photo.GetById(guid);

		Page.Title = Resources.labels.photos;

		btnDelete.Click += new EventHandler(btnPhoto_Click);
	}

	#region Event handlers

	/// <summary>
	/// deletes the photo
	/// </summary>
	private void btnPhoto_Click(object sender, EventArgs e)
	{
		string albumid = photo.Album.Id.ToString();
		photo.Delete();
		photo.Save();
		Response.Redirect("ViewPhotoAlbum.aspx?AlbumId=" + albumid);
	}

	#endregion

}
